﻿<common:LayoutAwarePage x:Class="StoreAppLibDemo.Examples.Converter.SolidColorBrushConverterPage"
                        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                        xmlns:common="using:StoreAppLibDemo.Common"
                        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                        xmlns:local="using:StoreAppLibDemo.Examples.Converter"
                        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                        mc:Ignorable="d">


    <Grid Style="{StaticResource AppPageStyle}">
        <Grid.RowDefinitions>
            <RowDefinition Height="100" />
            <RowDefinition Height="40" />
            <RowDefinition />
            <RowDefinition Height="50" />
        </Grid.RowDefinitions>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Image Grid.Column="1"
                   Margin="0,0,50,0"
                   Source="ms-appx:///Assets/PageLogo.png" />
            <TextBlock Margin="120,0,0,0"
                       HorizontalAlignment="Left"
                       VerticalAlignment="Bottom"
                       Style="{StaticResource HeaderTextStyle}"
                       Text="Solid Color Brush Converter"
                       TextWrapping="Wrap" />
            <Button Margin="36,0,0,0"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Bottom"
                    Click="GoBack"
                    Content="Button"
                    Style="{StaticResource BackButtonStyle}" />

        </Grid>

        <TextBlock Grid.Row="3"
                   Margin="0,0,50,0"
                   HorizontalAlignment="Right"
                   VerticalAlignment="Center"
                   FontSize="9"
                   Text="Copyright ©  2012 Suresh Kumar T" />


        <Grid Grid.Row="2" Margin="120,0,50,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="40" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <TextBlock Style="{StaticResource BodyTextStyle}" TextWrapping="Wrap">
                <Run>SolidColorBrushConverter converts a color value during data binding. The converter supports color values in hexadecimal format and RGB format and automatically detects the input value format during binding. Following are the supported formats.</Run>
                <LineBreak />
                <LineBreak />
                <Run>Hexdecimal format string: #X2X2X2, #X2X2X2X2, X2X2X2 and X2X2X2X2</Run>
                <LineBreak />
                <Run>RGB format string : R,G,B and A,R,G,B</Run>
                <LineBreak />
                <LineBreak />
                <Run>The converter also supports converting SolidColorBrush value back to specified string format (two way binding). The default format of converted color value is #X2X2X2X2. To convert back to other formats, pass the format string as the convert parameter.</Run>
            </TextBlock>
            <Grid Grid.Row="2" Grid.RowSpan="3">
                <Grid.RowDefinitions>
                    <RowDefinition Height="50" />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="460" />
                    <ColumnDefinition Width="150" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <TextBlock Width="452"
                           Height="20"
                           Margin="0,15"
                           HorizontalAlignment="Left"
                           VerticalAlignment="Center"
                           Style="{StaticResource BodyTextStyle}"
                           Text="Enter a color value in Hex or RGB format. Eg. (FFFF1CAE, 255,255,28,174)"
                           TextWrapping="Wrap" />
                <Border x:Name="border"
                        Grid.Column="2"
                        Width="30"
                        Height="30"
                        Margin="0,10"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        Background="{Binding Text,
                                             Converter={StaticResource SolidColorBrushConverter},
                                             ElementName=textBox,
                                             Mode=TwoWay}"
                        BorderBrush="Black"
                        BorderThickness="1" />
                <TextBox x:Name="textBox"
                         Grid.Column="1"
                         Width="138"
                         Height="32"
                         Margin="0,9"
                         HorizontalAlignment="Left"
                         VerticalAlignment="Center"
                         Text="#FFFF1CAE"
                         TextWrapping="Wrap" />

            </Grid>

        </Grid>
    </Grid>
</common:LayoutAwarePage>